<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招商银行供应商门户-采购创造价值—_商务协同_历史订单</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<link href="../css/style_add.css" rel="stylesheet" type="text/css" />
<link href="css/collcss.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="../calendar/WdatePicker.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/caltimer.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/ajaxdeal.js"></script>
</head>

<body style='width:610px'>



<div id="main">
<div id="right">
<table width="610" border="0" cellpadding="0" cellspacing="0" height="28" >
<tr>
<td style="font-size:12px;color:red;">说明:只有在框架协议编号、采购订单号、校验码三项都填写的情况下才能找到对应的订单.</td>

<td style="width:100px;" align="right">
	
	
	<form action="order.do" name="downprint" method="post">
		<input type="submit" value="打    印" />
		<input type="hidden" value="${framework_accord_no}" name="framework_accord_no"/>
		<input type="hidden" value="${bill_no}" name="bill_no"/>
		<input type="hidden" value="${validate_code}" name="validation_code"/>
		<input type="hidden" value="3" name="type"/>
	</form>
</td>
</tr>
</table>
<p></p>
<form action="order.do" name="queryform" method="post">
  <table width="610" border="0" cellpadding="0" cellspacing="0" background="../images/th_bgc.jpg" height="28" >
    <tr>
      <td width="26" align="center"><img src="images/pur_001.jpg" width="12" height="12" border="0" /></td>
      <td width="110" align="center">
       
       
       
       
       <input name="framework_accord_no" type="text" class="sele_d" id="textfield" 
        
        value="<logic:empty name="framework_accord_no">框架协议编号</logic:empty><logic:notEmpty name="framework_accord_no">${framework_accord_no}</logic:notEmpty>" /></td>
      <td width="10"><img src="images/pur_002.jpg" width="10" height="1" border="0" /></td>
      <td width="110" align="center"><input name="bill_no" type="text" class="sele_d" id="textfield2" 
      
      value="<logic:empty name="bill_no">采购订单号</logic:empty><logic:notEmpty name="bill_no">${bill_no}</logic:notEmpty>" 
      
      /></td>
      <td width="10"><img src="images/pur_002.jpg" alt="" width="10" height="1" border="0" /></td>
      <td width="110" align="center">
      <input name="validation_code" type="text" class="sele_d" id="textfield3" 
      value="<logic:empty name="validate_code">校验码</logic:empty><logic:notEmpty name="validate_code">${validate_code}</logic:notEmpty>" />
      </td>
      
      <td width="74" align="center"><img src="images/pur_ani_001.jpg" width="54" height="18" border="0"  style="cursor:hand" onclick="queryData()"/></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  
  <input type="hidden" value="1" name="type"/>
 </form>
 
 
  <table width="610" border="0" cellpadding="0" cellspacing="0">
   
    <tr>
      <td width="128" height="15" ></td>
      <td width="176" ></td>
      <td width="96" ></td>
      <td width="210" > </td>
    </tr>
    <tr>
      <td height="30" align="right">框架协议编号：&nbsp;</td>
      <td align="left">${order.framework_accord_no}</td>
      <td align="right">采购订单编号：&nbsp;</td>
      <td align="left">${order.bill_no}</td>
    </tr>
    <tr>
      <td height="30" align="right">采购项目名称：&nbsp;</td>
      <td align="left">${order.projectname }</td>
      <td align="right">发布日期：&nbsp;</td>
      <td align="left">${order.pub_ts }</td>
    </tr>
    <tr>
      <td height="30" align="right">发布机构：&nbsp;</td>
      <td align="left">${order.pk_corp }</td>
      <td align="right">发布人：&nbsp;</td>
      <td align="left">${order.pub_userid }</td>
    </tr>
    
     <tr>
      <td height="30" align="right">送货地址：&nbsp;</td>
      <td align="left">${order.send_place}</td>
      <td align="right">收货人：&nbsp;</td>
      <td align="left">${order.receiver }</td>
    </tr>
     <tr>
      <td height="30" align="right">收货人电话：&nbsp;</td>
      <td align="left">${order.rphone}</td>
      <td align="right">&nbsp;</td>
      <td align="left">&nbsp;</td>
    </tr>
  </table>
<br>

  <table width="610" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td class="f-13-b-2a6ca7">送货登记表</td>
    </tr>
  </table>
  
  <form action="order.do" name="savedata" method="post">
  
  <input type="hidden" value="${order.pk_dd_order_main }" name="pk_dd_order_main"/>
  <div style="width:610px;overflow:auto; height:200px" >
  <table  border="0" cellpadding="0" cellspacing="0" class="f-12-333333" width="900px">
        <tr >
          <td  height="28" align="center"  bgcolor="#CCCCCC" >产品名称</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC" >产品型号</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">采购数量</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">单位</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">目录单价</td>
           <td  height="28" align="center"  bgcolor="#CCCCCC">正扣折扣率</td>
           <td  height="28" align="center"  bgcolor="#CCCCCC">折扣后单价</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">采购金额(元)</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">送货数量 </td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">送货金额(元)</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">送货登记日</td>
        </tr>
        
        <logic:notEmpty name="orderitemlist">
        
        	<logic:iterate id="orderitem" name="orderitemlist">
        		  <tr >
			          <td  height="28" align="center"   >${orderitem.prod_name }</td>
			           <td  height="28" align="center"   >${orderitem.prod_model }</td>
			          <td  height="28" align="center"  >${orderitem.purchase_quantity }</td>
			          <td  height="28" align="center" >${orderitem.unit }</td>
			           <td  height="28" align="center" >${orderitem.unit_price }</td>
			          <td  height="28" align="center"  >${orderitem.discount_rate}</td>
			          <td  height="28" align="center"  >${orderitem.discounted_price}</td>
			          <td  height="28" align="center"  >${orderitem.amount }<input type="hidden" id="discounted_price${orderitem.index}" value="${orderitem.discounted_price}" /></td>
			          <td  height="28" align="center"  ><input type="hidden" value=${orderitem.pk_dd_order_item } name="pk_dd_order_item"/>
			          		<input type="text" name="supply_num" size="5" onchange="calPrice(${orderitem.index},this)"/> 
			          </td>
			          <td  height="28" align="center"  ><input type="text" name="supply_amount" id="supply_amount${orderitem.index }"  size="5"/></td>
			          <td  height="28" align="center" >${currentdate}</td>
			     </tr>
			      <tr>
          				<td colspan="7" height="1" bgcolor="#cccccc"></td>
  				</tr>
        	</logic:iterate>
        </logic:notEmpty> 
  </table>
  </div>
  
  
  <table width="610px" border="0" cellpadding="0" cellspacing="0" class="f-12-333333">
  <tr  >
  		<td colspan='7' class="f-13-b-2a6ca7" width="610px" align="left">
  			供应商送货历史信息
  		</td>
  </tr>
  
  </table>
  <div style="width:610px;overflow:auto; height:200px" >
  
  <table width="1000px" border="0" cellpadding="0" cellspacing="0" class="f-12-333333">
  <tr >
           <td  height="28" align="center"  bgcolor="#CCCCCC" >产品名称</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC" >产品型号</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">采购数量</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">单位</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">目录单价</td>
           <td  height="28" align="center"  bgcolor="#CCCCCC">正扣折扣率</td>
           <td  height="28" align="center"  bgcolor="#CCCCCC">折扣后单价</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">采购金额(元)</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">送货数量 </td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">送货金额(元)</td>
          <td  height="28" align="center"  bgcolor="#CCCCCC">送货登记日</td>
  </tr>
  <logic:notEmpty name="orderdetail">
  <logic:iterate id="orderitem" name="orderdetail">
        		  <tr >
			          <td  height="28" align="center"   >${orderitem.prod_name }</td>
			          <td  height="28" align="center"   >${orderitem.prod_model }</td>
			          <td  height="28" align="center"  >${orderitem.purchase_quantity }</td>
			          <td  height="28" align="center"  >${orderitem.unit }</td>
			          <td  height="28" align="center" >${orderitem.unit_price }</td>
			          <td height="28" align="center"  >${orderitem.discount_rate }</td>
			           <td  height="28" align="center"  >${orderitem.discounted_price }</td>
			          <td  height="28" align="center"  >${orderitem.amount }</td>
			          <td  height="28" align="center">
			          		${orderitem.supply_num} 
			          </td>
			          <td  height="28" align="center" >${orderitem.supply_amount}</td>
			          <td  height="28" align="center">${orderitem.check_in_date }</td>
			     </tr>
			     <tr>
          				<td colspan="7" height="1" bgcolor="#cccccc"></td>
  				</tr>
  </logic:iterate>    
  </logic:notEmpty> 	
</table>
</div>
<span>&nbsp;</span>
<center>
<a href="#"><img src="../images/botton_confirmation .jpg" onclick="submitValue()" 
width="60" height="20" border="0" style="cursor:hand"/></a>
 </center> 
  
  <input type="hidden" value="${framework_accord_no}" name="framework_accord_no"/>
  <input type="hidden" value="${bill_no}" name="bill_no"/>
  <input type="hidden" value="${validate_code}" name="validation_code"/>
  <input type="hidden" value="2" name="type"/>
  </form>
</div>
</div>
<!--页面主体内容结束-->
<script language="javascript">

parent.hideHideFun();

var message = "${ordersuccess}";
if(message != ""){
	parent.showHideFun();
	parent.changeShowMessage(message,'yes','ok');	
}
//判断送货数量是否为空或为数字
function checkSupply_num()
{
	var supply_nums = document.all("supply_num");
	var reg = /(^\d{1,8}$)|(^\d{1,8}\.\d{1,2}$)/;
	if(supply_nums != null)
	{
		for(var index = 0; index<supply_nums.length; index++)
		{
			var supply_num = supply_nums[index];
			if(supply_num.value == '')
			{
				showmess("请填写送货数量!");
				supply_num.style.backgroundColor="#ffaa44";
				return false;
			}else if(!reg.test(supply_num.value))
			{
				showmess("请确认填写的送货数量是否为数字!");
				supply_num.style.backgroundColor="#ffaa44";
				return false;
			}
		}
	}
	
	return true;
}


//判断送货金额是否为数字或为空
function checkSupply_amount()
{
	var supply_amounts = document.all("supply_amount");
	var reg = /(^\d{1,8}$)|(^\d{1,8}\.\d{1,2}$)/;
	if(supply_amounts != null)
	{
		for(var index = 0; index<supply_amounts.length; index++)
		{
			var supply_amount = supply_amounts[index];
			if(supply_amount.value == '')
			{
				showmess("请填写送货金额!");
				supply_amount.style.backgroundColor="#ffaa44";
				return false;
			}else if(!reg.test(supply_amount.value))
			{
				showmess("请确认填写的送货金额是否为数字!");
				supply_amount.style.backgroundColor="#ffaa44";
				return false;
			}
		}
	}
	
	return true;
}

function queryData()
{
	document.queryform.submit();
}

function submitValue()
{
	if(checkSupply_num() && checkSupply_amount())
	{

		parent.showHideFun();
		parent.changeShowMessage("数据处理中,请等候.....");
		document.savedata.submit();
	}
}


//计算价格

function calPrice(index,obj)
{
	var supply_num = obj.value;
	
	
	var  discounted_price = document.getElementById("discounted_price"+index).value;
	var  supply_amount = document.getElementById("supply_amount"+index);
	
	if(supply_num == '' || discounted_price == '')
	{
		return;
	}else
	{
		var tempPrice = parseFloat(supply_num)*parseFloat(discounted_price);
		tempPrice = new String(tempPrice);
		if(tempPrice.lastIndexOf(".") != -1)
		{
			supply_amount.value = tempPrice.substring(0,tempPrice.lastIndexOf(".")+3);
		}else
		{
			supply_amount.value  = tempPrice;
		}
	}
}
</script>
</body>
</html>
